using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using ns20;

namespace Newtonsoft.Json.Linq
{
	public class JProperty : JContainer
	{
		private readonly List<JToken> list_0 = new List<JToken>();

		private readonly string string_0;

		protected override IList<JToken> ChildrenTokens => list_0;

		public string Name
		{
			[DebuggerStepThrough]
			get
			{
				return string_0;
			}
		}

		public new JToken Value
		{
			[DebuggerStepThrough]
			get
			{
				if (list_0.Count <= 0)
				{
					return null;
				}
				return list_0[0];
			}
			set
			{
				method_2();
				JToken jtoken_ = value ?? new JValue((object)null);
				if (list_0.Count == 0)
				{
					Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206F_206C_206F_206D_202A_200D_202E_202E_200B_202D_202C_206D_200F_202A_200D_202C_202B_202A_206D_202D_202A_200D_206A_200E_206C_206C_200C_202B_206D_200E_206E_200B_200B_206A_202E_200F_206F_206F_202E_206C_202E(0, jtoken_, bool_1: false);
				}
				else
				{
					Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206D_206D_202C_206A_206B_206A_200C_206B_202A_202C_206E_200D_206C_202E_206A_206F_206B_202A_200F_206E_206A_202E_200B_206C_200F_200D_202B_202D_200C_206B_206E_206D_200E_206B_200D_206C_202C_206A_202B_206E_202E(0, jtoken_);
				}
			}
		}

		public override JTokenType Type
		{
			[DebuggerStepThrough]
			get
			{
				return JTokenType.Property;
			}
		}

		public JProperty(JProperty other)
			: base(other)
		{
			string_0 = other.Name;
		}

		internal override JToken Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206D_200D_200D_206C_202C_206E_200C_206B_200B_200E_200D_206F_200F_200F_206F_206A_202B_200E_206D_206E_206E_206B_202A_206B_200B_200D_206B_202A_202B_206D_202C_206B_202B_206F_200F_200C_202C_200B_202C_206E_202E(int int_0)
		{
			if (int_0 != 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			return Value;
		}

		internal override void Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206D_206D_202C_206A_206B_206A_200C_206B_202A_202C_206E_200D_206C_202E_206A_206F_206B_202A_200F_206E_206A_202E_200B_206C_200F_200D_202B_202D_200C_206B_206E_206D_200E_206B_200D_206C_202C_206A_202B_206E_202E(int int_0, JToken jtoken_2)
		{
			if (int_0 != 0)
			{
				throw new ArgumentOutOfRangeException();
			}
			if (!JContainer.smethod_6(Value, jtoken_2))
			{
				if (base.Parent != null)
				{
					((JObject)base.Parent).method_15(this);
				}
				base.Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206D_206D_202C_206A_206B_206A_200C_206B_202A_202C_206E_200D_206C_202E_206A_206F_206B_202A_200F_206E_206A_202E_200B_206C_200F_200D_202B_202D_200C_206B_206E_206D_200E_206B_200D_206C_202C_206A_202B_206E_202E(0, jtoken_2);
				if (base.Parent != null)
				{
					((JObject)base.Parent).method_14(this);
				}
			}
		}

		internal override bool Newtonsoft_002EJson_002ELinq_002EJContainer_002E_202E_200B_202D_206B_200C_200B_200B_200D_202B_202B_206F_202C_206C_202D_200D_200F_202E_206B_206B_206C_206F_202D_206F_200D_202E_202E_206B_206B_200F_200C_200C_206C_200E_202B_200F_206F_206A_200C_206B_200F_202E(JToken jtoken_2)
		{
			throw new JsonException("Cannot add or remove items from {0}.".smethod_0(CultureInfo.InvariantCulture, typeof(JProperty)));
		}

		internal override void Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206F_200D_202C_202E_200E_202D_202C_202B_206F_206A_202C_206A_202A_200F_206C_200D_200F_206C_202D_200E_206C_206E_206F_202C_200E_206B_202E_202D_206B_206F_200B_200C_200E_206F_200C_200F_200D_206F_202C_206A_202E(int int_0)
		{
			throw new JsonException("Cannot add or remove items from {0}.".smethod_0(CultureInfo.InvariantCulture, typeof(JProperty)));
		}

		internal override void Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206F_206C_206F_206D_202A_200D_202E_202E_200B_202D_202C_206D_200F_202A_200D_202C_202B_202A_206D_202D_202A_200D_206A_200E_206C_206C_200C_202B_206D_200E_206E_200B_200B_206A_202E_200F_206F_206F_202E_206C_202E(int int_0, JToken jtoken_2, bool bool_1)
		{
			if (Value != null)
			{
				throw new JsonException("{0} cannot have multiple values.".smethod_0(CultureInfo.InvariantCulture, typeof(JProperty)));
			}
			base.Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206F_206C_206F_206D_202A_200D_202E_202E_200B_202D_202C_206D_200F_202A_200D_202C_202B_202A_206D_202D_202A_200D_206A_200E_206C_206C_200C_202B_206D_200E_206E_200B_200B_206A_202E_200F_206F_206F_202E_206C_202E(0, jtoken_2, bool_1: false);
		}

		internal override bool Newtonsoft_002EJson_002ELinq_002EJContainer_002E_202B_206F_202C_202A_206C_200C_206A_206E_200F_202B_206E_200D_206E_206A_206E_206A_202A_202C_202C_200C_200B_200E_206D_200E_206F_206C_206F_202C_202E_200F_202D_200F_206E_206A_200F_202D_202E_200F_202E_206B_202E(JToken jtoken_2)
		{
			return Value == jtoken_2;
		}

		internal override void Newtonsoft_002EJson_002ELinq_002EJContainer_002E_200E_202C_200D_206A_202A_200C_202D_200E_200B_206E_200D_202B_202E_202C_200D_200B_202C_202E_206B_200B_206D_202A_202C_202D_202B_202B_206B_200D_200B_206B_206D_200C_202B_206D_202E_202A_200F_200C_206C_206C_202E()
		{
			throw new JsonException("Cannot add or remove items from {0}.".smethod_0(CultureInfo.InvariantCulture, typeof(JProperty)));
		}

		internal override bool Newtonsoft_002EJson_002ELinq_002EJToken_002E_206F_200C_206F_206F_206B_200E_206C_206B_200C_200D_202E_200E_200E_200D_202C_200D_200C_206B_200F_202D_202E_200F_200C_202D_206B_200D_206B_206E_202E_206E_202B_206D_206E_206F_202C_202E_200D_200C_200D_200F_202E(JToken jtoken_2)
		{
			JProperty jProperty = jtoken_2 as JProperty;
			if (jProperty != null && string_0 == jProperty.Name)
			{
				return method_3(jProperty);
			}
			return false;
		}

		internal override JToken Newtonsoft_002EJson_002ELinq_002EJToken_002E_206F_206A_202E_200B_200D_206A_200C_200E_206A_202D_200E_206E_206F_200B_206C_200F_200C_200C_202A_206B_200C_202D_200B_202B_202A_202D_202B_206A_206F_206F_202D_200C_206F_202E_206B_200D_206C_202D_202E_200E_202E()
		{
			return new JProperty(this);
		}

		internal JProperty(string name)
		{
			Class204.smethod_2(name, "name");
			string_0 = name;
		}

		public JProperty(string name, params object[] content)
			: this(name, (object)content)
		{
		}

		public JProperty(string name, object content)
		{
			Class204.smethod_2(name, "name");
			string_0 = name;
			Value = (method_4(content) ? new JArray(content) : method_9(content));
		}

		public override void WriteTo(JsonWriter writer, params JsonConverter[] converters)
		{
			writer.WritePropertyName(string_0);
			JToken value = Value;
			if (value != null)
			{
				value.WriteTo(writer, converters);
			}
			else
			{
				writer.WriteNull();
			}
		}

		internal override int Newtonsoft_002EJson_002ELinq_002EJToken_002E_200C_202A_206D_200B_206C_206F_202A_200F_200E_206E_200D_202D_200B_200D_206E_202D_206E_200D_202E_206B_206F_206F_202B_206D_206D_202E_206C_200F_202D_202A_206B_206B_200D_202A_200C_202D_200F_202A_206F_200F_202E()
		{
			return string_0.GetHashCode() ^ ((Value != null) ? Value.Newtonsoft_002EJson_002ELinq_002EJToken_002E_200C_202A_206D_200B_206C_206F_202A_200F_200E_206E_200D_202D_200B_200D_206E_202D_206E_200D_202E_206B_206F_206F_202B_206D_206D_202E_206C_200F_202D_202A_206B_206B_200D_202A_200C_202D_200F_202A_206F_200F_202E() : 0);
		}

		public new static JProperty Load(JsonReader reader)
		{
			if (reader.JsonToken_0 == JsonToken.None && !reader.Read())
			{
				throw JsonReaderException.smethod_1(reader, "Error reading JProperty from JsonReader.");
			}
			while (reader.JsonToken_0 == JsonToken.Comment)
			{
				reader.Read();
			}
			if (reader.JsonToken_0 != JsonToken.PropertyName)
			{
				throw JsonReaderException.smethod_1(reader, "Error reading JProperty from JsonReader. Current JsonReader item is not a property: {0}".smethod_0(CultureInfo.InvariantCulture, reader.JsonToken_0));
			}
			JProperty jProperty = new JProperty((string)reader.Object_0);
			jProperty.method_0(reader as IJsonLineInfo);
			jProperty.method_10(reader);
			return jProperty;
		}
	}
}
